package com.centaline.androidsalesblog.api.sale;

import com.android.volley.DefaultRetryPolicy;
import com.android.volley.Request;
import com.android.volley.RetryPolicy;
import com.centaline.androidsalesblog.api.SaleApi;
import com.centaline.androidsalesblog.model.responseobject.StoreListRo;
import com.centanet.framework.interfaces.IResponseListener;

/**
 * 门店列表
 * Created by Lihq on 16/2/15.
 */
public class StoreListApi extends SaleApi<StoreListRo> {

    private String region = "";//区域信息
    private String lat = "";//经度
    private String lng = "";//纬度
    private String sort = "3";//排序，2表示规模由小到大，3表示规模由大到小，4表示距离由近到远
    private int startIndex;//起始分页
    private int pagecount;//分页数量

    public StoreListApi(Class<?> tag, Class<StoreListRo> aClass, IResponseListener<StoreListRo> iResponseListener) {
        super(tag, aClass, iResponseListener);
    }

    public void setRegion(String region) {
        this.region = region;
    }

    public void setLat(String lat) {
        this.lat = lat;
    }

    public void setLng(String lng) {
        this.lng = lng;
    }

    public void setSort(String sort) {
        this.sort = sort;
    }

    public void setPagecount(int pagecount) {
        this.pagecount = pagecount;
    }

    public void setStartIndex(int startIndex) {
        this.startIndex = startIndex;
    }

    public int getStartIndex() {
        return startIndex;
    }

    @Override
    public int getMethod() {
        return Request.Method.GET;
    }

    @Override
    protected void setParams() {
        putParams("region", region);
        putParams("lat", lat);
        putParams("lng", lng);
        putParams("sort", sort);
        putParams("startIndex", startIndex);
        putParams("pagecount", pagecount);
    }

    @Override
    protected RetryPolicy getRetryPolicy() {
        return new DefaultRetryPolicy(2500, 3, 1.0F);
    }

    @Override
    protected String getPath() {
        return "Store";
    }
}
